package org.naxx.security.test.unit.tck.parsing;

import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;

import junit.framework.TestCase;

public abstract class AbstractTckParsingTestCase extends TestCase {
	
	private static final String[] folders = {
		"tck/II/A", "tck/II/B", "tck/II/C", "tck/II/D", "tck/II/E",
	};
	
	@SuppressWarnings("unchecked")
	public List<File> getFilesForParsing() {
		List<File> files = new ArrayList<File>();
		for (int i = 0; i < folders.length; i++) {
			File[] matches = new File(folders[i]).listFiles(new FilenameFilter() {
				public boolean accept(File dir, String name) {
					return name.endsWith(AbstractTckParsingTestCase.this.getSuffix()) && 
						!AbstractTckParsingTestCase.this.getSkipSet().contains(name);
				}
			});
			files.addAll(Arrays.asList(matches));
//			files.addAll(Util.arrayToList(matches));
		}
		return files;
	}

	public abstract Set<String> getSkipSet();
	
	public abstract String getSuffix();
}
